Skip to content

feat(ai-cache): add streaming support with format tagging#13644

Merged
shreemaan-abhishek merged 5 commits into
apache:masterfrom
janiussyafiq:feat/ai-cache-streaming
Jul 3, 2026
Merged

feat(ai-cache): add streaming support with format tagging#13644
shreemaan-abhishek merged 5 commits into
apache:masterfrom
janiussyafiq:feat/ai-cache-streaming

Conversation

@janiussyafiq

@janiussyafiq janiussyafiq commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

Extends the ai-cache plugin (#13632) to cache streaming responses: SSE streams are captured in body_filter behind a completeness gate and replayed on cache hits with the correct Content-Type, with cache entries tagged by body format (json/sse) sourced from the ai-providers streaming framing. Also refactors Redis connection management into a shared with_redis helper with fail-open handling and improves error handling in the L1 backfill path.

Which issue(s) this PR fixes:

Part of #13290

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Capture and replay SSE streaming responses with a completeness gate,
tagging cache entries with their body format (json/sse) sourced from
the ai-providers streaming framing.

Also refactor Redis connection management into a shared with_redis
helper with fail-open handling, and improve error handling in the
L1 backfill path.
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request labels Jul 2, 2026
Comment thread apisix/plugins/ai-cache/stream.lua Outdated
Comment thread apisix/plugins/ai-providers/base.lua
Comment thread apisix/plugins/ai-cache.lua
@shreemaan-abhishek shreemaan-abhishek merged commit a2d34cd into apache:master Jul 3, 2026
22 checks passed
@janiussyafiq janiussyafiq deleted the feat/ai-cache-streaming branch July 3, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants